1. Field of the Invention
The present invention generally relates to computer databases. More specifically, the present invention relates to adding timeline support and timeline operators used in constructing a query of an abstract database.
2. Description of the Related Art
Databases are well known systems for information storage and retrieval. The most prevalent type of database used today is the relational database that stores data in a set of tables that may be reorganized and accessed in a number of different ways. A relational database management system (DBMS) uses relational techniques for storing and retrieving data.
Structured Query Language (SQL) is a well known database language that that includes commands for retrieving, storing, updating, and deleting data stored in a relational database. An SQL query is constructed as a text string that must strictly conform to the grammar requirements of the SQL query language. SQL provides support for users to specify a set of conditions applied to the data retrieved by an SQL query. Typical operators include logical operators such as “and” and “or,” and numerical operators, such as “equals,” “greater than,” and “less than” operators. From these basic operators, complex conditional expressions may be created. Building complex conditional expressions from these basic constructs, however, is often very challenging to the average user of a database. Further, an SQL query must be semantically correct to perform as desired by the user. That is, many syntactically correct SQL statements may fail to perform as desired due to semantic or logical errors in a conditional expression.
Because of this complexity, users often turn to database query applications to assist them in composing an SQL query of a relational database. For example, one technique for managing the complexity of a relational database and the SQL query language is to use database abstraction techniques. Commonly assigned U.S. patent application Ser. No. 10/083,075 (the '075 application) entitled “Application Portability and Extensibility through Database Schema and Query Abstraction,” discloses a framework that provides an abstract view of a physical data storage mechanism. The framework of the '075 application provides a requesting entity (i.e., an end-user or front-end application) with an abstract representation of data stored in an underlying physical storage mechanism, such as a relational database.
Using the database abstraction model, logical fields are defined that describe data stored in an underlying database. In one embodiment of a database abstraction model, each logical field specifies an access method that specifies how to retrieve data from an underlying database system corresponding to the logical field. Users compose abstract queries by selecting logical fields and specifying conditions. The conditions available for composing an abstract query generally include the same conditional operators available in SQL. The system retrieves data from the underlying database by generating a resolved query (e.g., an SQL statement) from the abstract query. Because the database abstraction model is not tied to the syntax and semantics of an underlying database, additional operators and functions may be provided that extend the capabilities of the database abstraction model without having to modify the underlying database.
For example, users are often interested in querying data using temporal conditions, and a desirable abstract query might specify conditions that depend on when an event occurred. Consider the following query built from more basic logical and arithmetic operators:
      find    ⁢                  ⁢          (                                    (                                                                                                     ′′                                    ⁢                  Test                                ⁢                                                                  ⁢                1                ⁢                                                                  ⁢                Results                            =                              20                ′′                                      )                    ⁢                                          ⁢          AND          ⁢                                          ⁢                      (                                          Test                ⁢                                                                  ⁢                1.                ⁢                                                                                          ⁢                                                                                        ⁢                Testdate                            <                              Test                ⁢                                                                  ⁢                2.                ⁢                                                                  ⁢                testdate                                      )                    ⁢                                          ⁢          AND          ⁢                                          ⁢                                                   ′′                        ⁢            Test                    ⁢                                          ⁢          2          ⁢                                          ⁢          results                =                  50          ′′                    )        )The desired query results are not readily apparent from the query; however, the query is used to retrieve results for an intuitive temporal condition: “before.” The “before” condition is captured in the middle expression “(Test1.Testdate<Test2.testdate)” “ANDed” with the test results conditions. Moreover, composing this query requires that a user correctly select the conditions, operators, and the precedence of conditions, included in an abstract query.
Accordingly, there exists a need to expand the capabilities provided by an abstract database to support timeline based conditions and to provide users with the ability to specify query conditions using temporal operators.